<html manifest="IGNORE.manifest" lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<!DOCTYPE html>
<html manifest="IGNORE.manifest" lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css/reset.css" th:href="@{${uiPath} + ${appName} + '/css/reset.css'}"/>
    <link rel="stylesheet" type="text/css" href="../css/CLSRZ.css" th:href="@{${uiPath} + ${appName} + '/css/CLSRZ.css'}"/>
    <link rel="stylesheet" type="text/css" href="../css/zdialog.css"
          th:href="@{${uiPath} + ${appName} + '/css/zdialog.css'}"/>
</head>
<body>
<div id="shangpinzs" class="azong">
    <div class="gtoubu">
        <p class="shpingunli">商品管理</p>
        <p class="wodexioajiasp">已下架商品</p>
        <a ><img class="fanhui" src="../images/raw_1503386635.png" alt="" th:src="@{${uiPath} + ${appName} + '/images/raw_1503386635.png'}"></a>
    </div>
    <div class="kuaiw"> </div>
    <a href="../CLS/CLS_SG_AddCaShop.html" th:href="@{'/materialGoods/addGoods'}">
        <p class="addshop">添加商品</p>

    </a>

    <div class="addlist">
        <p class="listtitle">商品列表</p>

        <div class="spzshi" >
            <a href="../CLS/CLS_SGShopXq.html" th:each="goods,goosStat:${result}" th:href="@{'/materialGoods/shopXq?goodsId='+${goods.goodsId}}">
                <div class="renwuliebiao">
                    <dl class="jianjiansha">
                        <dt class="adtouxiang">
                            <img  src="../images/raw_1503973402.jpeg"  th:src="${goods.model.imgUrl}">
                        </dt>
                        <dd class="renwuxinxi">
                            <p class="name" th:utext="${goods.goodsName}">黄金沙</p>
                            <p class="addkucun" >库存量:<span th:utext="${goods.amount}">200000</span></p>
                            <p class="anlishu">销量:<span th:utext="${goods.sales}">0</span> 万</p>
                            <p class="phone" th:utext="'￥'+${goods.model.price}">￥25</p>
                        </dd>
                        <dd class="addright" th:if="${goods.isOpenpin==1}">
                            <p class="yikaiqipd" >已开启拼单</p>
                            <p class="rightt"></p>
                        </dd>
                    </dl>
                </div>
            </a>
        </div>
        <div class="fenye">
            <p class="shouwe" th:onclick="'pageShouye()'">首页</p>
            <p class="shouwe" th:onclick="'pagePre()'">上一页</p>
            <p class="shouwe" id="ye" th:utext="'1/'+${ye}">1/20</p>
            <input type="hidden" th:value="${ye}" id="zongye">
            <input type="hidden" th:value="${total}" id="zongtiaoshu">
            <p class="shouwe" th:onclick="'pageNext()'">下一页</p>
            <p class="shouwe" th:onclick="'pageWeiYe()'">尾页</p>
        </div>

    </div>
    <form id="commentForm" th:action="@{'/materialGoods/nextPage'}" method="post">
    </form>
    <script type="text/javascript" src="../js/flexible.js" th:src="@{${uiPath} + ${appName} + '/js/flexible.js'}"></script>
    <script type="text/javascript" src="../js/jquery.min.js" th:src="@{${uiPath} + ${appName} + '/js/jquery.min.js'}"></script>
    <!-- <script type="text/javascript" src="../js/basevalue.js"></script> -->
    <script type="text/javascript" src="../js/zdialog.js" th:src="@{${uiPath} + ${appName} + '/js/zdialog.js'}"></script>

    <script type="text/javascript" src="../js/CLSRZ.js" th:src="@{${uiPath} + ${appName} + '/js/CLSRZ.js'}"></script>
    <script th:inline="javascript">
    var ye=1;
    var zongye=$('#zongye').val();
    var yeshu=0;
    var tiaoshu=3;
    var zongtiaoshu=$('#zongtiaoshu').val();
    function pageNext(){
        $.DialogByZ.Loading(/*[[${uiPath}+${appName}+'/images/loading.png']]*/)

        var b= Math.ceil(zongtiaoshu/3);
        if(ye==b){
            $.DialogByZ.Close();
            $.DialogByZ.Alert({Title: "失败", Content: "已经是最后一页了哦", BtnL: "确定"})
        }else{
            $.ajax({
                    type:'post',
                    url: $('#commentForm').attr('action'),
                    dataType: 'json',
                    data:{'limit':tiaoshu,'offset':yeshu+3,'order':'asc'},
                    success:function (result) {
                        console.info(result);
                        if (result.code == 1) {
                            console.info(result.data);
                            var data2=result.data;
                            var tol ="";
                            $('.spzshi').hide();
                            var div= $("<div class='spzshi'> </div>");
                            for(var i in data2){
                                if(data2[i].isOpenpin==1){
                                    tol =tol+ "<a href='/materialGoods/shopXq?goodsId=" +data2[i].goodsId+"'>"+"<div class='renwuliebiao'>"+"<dl class='jianjiansha'>"+"<dt class='adtouxiang'>"+"<img src='"+data2[i].model.imgUrl+"'>"+"</dt>"+"<dd class='renwuxinxi'>"+"<p class='name'>"+data2[i].goodsName+"</p>"+"<p class='addkucun'>"+"库存量"+"<span>"+data2[i].amount+"</span>"+"</p>"+"<p class='anlishu'>"+"销量"+"<span>"+data2[i].sales+"</span>"+"</p>"+"<p class='linian'>"+"配送费"+"<span>"+data2[i].sendPrice+"/公里"+"</span>"+"</p>"+"<p class='phone'>"+"￥"+data2[i].model.price+"</p>"+"</dd>"+"<dd class='addright'>"+"<p class='yikaiqipd'>"+"已开启拼单"+"</p>"+"<p class='rightt'>"+"</p>"+"</dd>"+"</dl>"+"</div>"+ "</a>"
                                }else{
                                    tol =tol+ "<a href='/materialGoods/shopXq?goodsId=" +data2[i].goodsId+"'>"+"<div class='renwuliebiao'>"+"<dl class='jianjiansha'>"+"<dt class='adtouxiang'>"+"<img src='"+data2[i].model.imgUrl+"'>"+"</dt>"+"<dd class='renwuxinxi'>"+"<p class='name'>"+data2[i].goodsName+"</p>"+"<p class='addkucun'>"+"库存量"+"<span>"+data2[i].amount+"</span>"+"</p>"+"<p class='anlishu'>"+"销量"+"<span>"+data2[i].sales+"</span>"+"</p>"+"<p class='linian'>"+"配送费"+"<span>"+data2[i].sendPrice+"/公里"+"</span>"+"</p>"+"<p class='phone'>"+"￥"+data2[i].model.price+"</p>"+"</dd>"+"</dl>"+"</div>"+ "</a>"

                                }
                            }
                            console.info(tol);
                            div.append(tol);
                            $('.addlist').append(div);
                            $('#ye').html(ye+1+"/"+zongye);
                            ye++;
                            yeshu=yeshu+3;
                            $.DialogByZ.Close();

                        }

                    }


                }


            )
        }



    }
    function pagePre(){
        var y=yeshu-3;
        if(ye==1){
            $.DialogByZ.Alert({Title: "失败", Content: "已经是第一页了哦", BtnL: "确定"})
        }else{
            $.ajax({
                    type:'post',
                    url: $('#commentForm').attr('action'),
                    dataType: 'json',
                    data:{'limit':tiaoshu,'offset':y,'order':'asc'},
                    success:function (result) {
                        console.info(result);
                        if (result.code == 1) {
                            console.info(result.data);
                            var data2=result.data;
                            var tol ="";
                            $('.spzshi').hide();
                            var div= $("<div class='spzshi'> </div>");
                            for(var i in data2){
                                if(data2[i].isOpenpin==1){
                                    tol =tol+ "<a href='/materialGoods/shopXq?goodsId=" +data2[i].id+"'>"+"<div class='renwuliebiao'>"+"<dl class='jianjiansha'>"+"<dt class='adtouxiang'>"+"<img src='"+data2[i].model.imgUrl+"'>"+"</dt>"+"<dd class='renwuxinxi'>"+"<p class='name'>"+data2[i].goodsName+"</p>"+"<p class='addkucun'>"+"库存量"+"<span>"+data2[i].amount+"</span>"+"</p>"+"<p class='anlishu'>"+"销量"+"<span>"+data2[i].sales+"</span>"+"</p>"+"<p class='linian'>"+"配送费"+"<span>"+data2[i].sendPrice+"/公里"+"</span>"+"</p>"+"<p class='phone'>"+"￥"+data2[i].model.price+"</p>"+"</dd>"+"<dd class='addright'>"+"<p class='yikaiqipd'>"+"已开启拼单"+"</p>"+"<p class='rightt'>"+"</p>"+"</dd>"+"</dl>"+"</div>"+ "</a>"
                                }else{
                                    tol =tol+ "<a href='/materialGoods/shopXq?goodsId=" +data2[i].id+"'>"+"<div class='renwuliebiao'>"+"<dl class='jianjiansha'>"+"<dt class='adtouxiang'>"+"<img src='"+data2[i].model.imgUrl+"'>"+"</dt>"+"<dd class='renwuxinxi'>"+"<p class='name'>"+data2[i].goodsName+"</p>"+"<p class='addkucun'>"+"库存量"+"<span>"+data2[i].amount+"</span>"+"</p>"+"<p class='anlishu'>"+"销量"+"<span>"+data2[i].sales+"</span>"+"</p>"+"<p class='linian'>"+"配送费"+"<span>"+data2[i].sendPrice+"/公里"+"</span>"+"</p>"+"<p class='phone'>"+"￥"+data2[i].model.price+"</p>"+"</dd>"+"</dl>"+"</div>"+ "</a>"

                                }                            }
                            console.info(tol);
                            div.append(tol);
                            $('.addlist').append(div);
                            $('#ye').html(ye-1+"/"+zongye);
                            ye--;
                            yeshu=yeshu-3;
                            $.DialogByZ.Close();

                        }

                    }


                }


            )

        }


    }
    function pageShouye(){
        $.ajax({
                type:'post',
                url: $('#commentForm').attr('action'),
                dataType: 'json',
                data:{'limit':tiaoshu,'offset':0,'order':'asc'},
                success:function (result) {
                    console.info(result);
                    if (result.code == 1) {
                        console.info(result.data);
                        var data2=result.data;
                        var tol ="";
                        $('.spzshi').hide();
                        var div= $("<div class='spzshi'> </div>");
                        for(var i in data2){
                            if(data2[i].isOpenpin==1){
                                tol =tol+ "<a href='/materialGoods/shopXq?goodsId=" +data2[i].goodsId+"'>"+"<div class='renwuliebiao'>"+"<dl class='jianjiansha'>"+"<dt class='adtouxiang'>"+"<img src='"+data2[i].model.imgUrl+"'>"+"</dt>"+"<dd class='renwuxinxi'>"+"<p class='name'>"+data2[i].goodsName+"</p>"+"<p class='addkucun'>"+"库存量"+"<span>"+data2[i].amount+"</span>"+"</p>"+"<p class='anlishu'>"+"销量"+"<span>"+data2[i].sales+"</span>"+"</p>"+"<p class='linian'>"+"配送费"+"<span>"+data2[i].sendPrice+"/公里"+"</span>"+"</p>"+"<p class='phone'>"+"￥"+data2[i].model.price+"</p>"+"</dd>"+"<dd class='addright'>"+"<p class='yikaiqipd'>"+"已开启拼单"+"</p>"+"<p class='rightt'>"+"</p>"+"</dd>"+"</dl>"+"</div>"+ "</a>"
                            }else{
                                tol =tol+ "<a href='/materialGoods/shopXq?goodsId=" +data2[i].goodsId+"'>"+"<div class='renwuliebiao'>"+"<dl class='jianjiansha'>"+"<dt class='adtouxiang'>"+"<img src='"+data2[i].model.imgUrl+"'>"+"</dt>"+"<dd class='renwuxinxi'>"+"<p class='name'>"+data2[i].goodsName+"</p>"+"<p class='addkucun'>"+"库存量"+"<span>"+data2[i].amount+"</span>"+"</p>"+"<p class='anlishu'>"+"销量"+"<span>"+data2[i].sales+"</span>"+"</p>"+"<p class='linian'>"+"配送费"+"<span>"+data2[i].sendPrice+"/公里"+"</span>"+"</p>"+"<p class='phone'>"+"￥"+data2[i].model.price+"</p>"+"</dd>"+"</dl>"+"</div>"+ "</a>"

                            }                        }
                        console.info(tol);
                        div.append(tol);
                        $('.addlist').append(div);
                        $('#ye').html("1/"+zongye);
                        ye=1;
                        yeshu=0;
                        $.DialogByZ.Close();

                    }

                }


            }


        )
    }
    function pageWeiYe(){
        var b="";
        if(zongtiaoshu%3==0){
            alert("zhengshu")

            b=zongtiaoshu-3
            }
            else{
            alert("yushu")
            var a= parseInt(zongtiaoshu/3);
            b=a*3;

        }
        $.ajax({
                type:'post',
                url: $('#commentForm').attr('action'),
                dataType: 'json',
                data:{'limit':tiaoshu,'offset':b,'order':'asc'},
                success:function (result) {
                    console.info(result);
                    if (result.code == 1) {
                        console.info(result.data);
                        var data2=result.data;
                        var tol ="";
                        $('.spzshi').hide();
                        var div= $("<div class='spzshi'> </div>");
                        for(var i in data2){
                            if(data2[i].isOpenpin==1){
                                tol =tol+ "<a href='/materialGoods/shopXq?goodsId=" +data2[i].goodsId+"'>"+"<div class='renwuliebiao'>"+"<dl class='jianjiansha'>"+"<dt class='adtouxiang'>"+"<img src='"+data2[i].model.imgUrl+"'>"+"</dt>"+"<dd class='renwuxinxi'>"+"<p class='name'>"+data2[i].goodsName+"</p>"+"<p class='addkucun'>"+"库存量"+"<span>"+data2[i].amount+"</span>"+"</p>"+"<p class='anlishu'>"+"销量"+"<span>"+data2[i].sales+"</span>"+"</p>"+"<p class='linian'>"+"配送费"+"<span>"+data2[i].sendPrice+"/公里"+"</span>"+"</p>"+"<p class='phone'>"+"￥"+data2[i].model.price+"</p>"+"</dd>"+"<dd class='addright'>"+"<p class='yikaiqipd'>"+"已开启拼单"+"</p>"+"<p class='rightt'>"+"</p>"+"</dd>"+"</dl>"+"</div>"+ "</a>"
                            }else{
                                tol =tol+ "<a href='/materialGoods/shopXq?goodsId=" +data2[i].goodsId+"'>"+"<div class='renwuliebiao'>"+"<dl class='jianjiansha'>"+"<dt class='adtouxiang'>"+"<img src='"+data2[i].model.imgUrl+"'>"+"</dt>"+"<dd class='renwuxinxi'>"+"<p class='name'>"+data2[i].goodsName+"</p>"+"<p class='addkucun'>"+"库存量"+"<span>"+data2[i].amount+"</span>"+"</p>"+"<p class='anlishu'>"+"销量"+"<span>"+data2[i].sales+"</span>"+"</p>"+"<p class='linian'>"+"配送费"+"<span>"+data2[i].sendPrice+"/公里"+"</span>"+"</p>"+"<p class='phone'>"+"￥"+data2[i].model.price+"</p>"+"</dd>"+"</dl>"+"</div>"+ "</a>"

                            }                        }
                        console.info(tol);
                        div.append(tol);
                        $('.addlist').append(div);
                        $('#ye').html(Math.ceil(zongtiaoshu/3)+"/"+zongye);
                        ye= Math.ceil(zongtiaoshu/3);
                        yeshu=b;
                        $.DialogByZ.Close();

                    }

                }


            }


        )
    }
    </script>
</body>
</html>